n=float(input())
x=n
if x>1000:
    cnt=int((x-0.5)/1000)
    x-=300*cnt
else:
    if x>500:
        cnt=int((x-0.5)/500)
        x-=100*cnt
    else:
        cnt=int((x-0.5)/300)
        x-=50*cnt

y=n
if y>=300:
    y=300+(y-300)*0.8

if x>y:
    x=y

print("%.2f" % x)